<?php
App::uses('Controller', 'Controller');
App::uses('CakeRequest', 'Network');
App::uses('CakeResponse', 'Network');
App::uses('ComponentCollection', 'Controller');
App::uses('Hungdv7SudokuComponent', 'Controller/Component');
App::uses ( 'CsvIterator', 'ZCommon' );

class TestSudokuController extends Controller {
}

class Hungdv7SudokuComponentTest extends CakeTestCase{
	public $SudokuComponent = null;	
	public $Controller = null;
	
	public function setUp(){
		parent::setUp();
		
		$Collection = new ComponentCollection();
		$this->SudokuComponent = new Hungdv7SudokuComponent($Collection);
		$CakeRequest = new CakeRequest();
		$CakeResponse = new CakeResponse();
		$this->Controller = new TestSudokuController($CakeRequest, $CakeResponse);
		$this->SudokuComponent->startup($this->Controller);
	}
	
	public function testSudokuTable(){
		
	}
	
	public function provider() {
		$file = TMP . 'tests/sudokuTestCases.csv';
		$arr_data = new CsvIterator ( $file );
	
		// convert iterator to array, remove null element, reindex
		$arr_data = array_values ( array_filter ( iterator_to_array ( $arr_data ) ) );
	
		// remove first element - for column title
		array_shift ( $arr_data );
		return $arr_data;
	}
	
	public function tearDown(){
		parent::tearDown();
		//clean up after test
		unset($this->SudokuComponent);
		unset($this->Controller);
	}
	
}